package com.ruoyi.project.tickets.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.tickets.mapper.TicketsRuleMapper;
import com.ruoyi.project.tickets.domain.TicketsRule;
import com.ruoyi.project.tickets.service.ITicketsRuleService;

/**
 * 票券规则Service业务层处理
 * 
 * @author 孙山伟
 * @date 2023-06-29
 */
@Service
public class TicketsRuleServiceImpl implements ITicketsRuleService 
{
    @Autowired
    private TicketsRuleMapper ticketsRuleMapper;

    /**
     * 查询票券规则
     * 
     * @param id 票券规则ID
     * @return 票券规则
     */
    @Override
    public TicketsRule selectTicketsRuleById(Long id)
    {
        return ticketsRuleMapper.selectTicketsRuleById(id);
    }

    /**
     * 查询票券规则列表
     * 
     * @param ticketsRule 票券规则
     * @return 票券规则
     */
    @Override
    public List<TicketsRule> selectTicketsRuleList(TicketsRule ticketsRule)
    {
        return ticketsRuleMapper.selectTicketsRuleList(ticketsRule);
    }

    /**
     * 新增票券规则
     * 
     * @param ticketsRule 票券规则
     * @return 结果
     */
    @Override
    public int insertTicketsRule(TicketsRule ticketsRule)
    {
        ticketsRule.setCreateTime(DateUtils.getNowDate());
        return ticketsRuleMapper.insertTicketsRule(ticketsRule);
    }

    /**
     * 修改票券规则
     * 
     * @param ticketsRule 票券规则
     * @return 结果
     */
    @Override
    public int updateTicketsRule(TicketsRule ticketsRule)
    {
        ticketsRule.setUpdateTime(DateUtils.getNowDate());
        return ticketsRuleMapper.updateTicketsRule(ticketsRule);
    }

    /**
     * 批量删除票券规则
     * 
     * @param ids 需要删除的票券规则ID
     * @return 结果
     */
    @Override
    public int deleteTicketsRuleByIds(Long[] ids)
    {
        return ticketsRuleMapper.deleteTicketsRuleByIds(ids);
    }

    /**
     * 删除票券规则信息
     * 
     * @param id 票券规则ID
     * @return 结果
     */
    @Override
    public int deleteTicketsRuleById(Long id)
    {
        return ticketsRuleMapper.deleteTicketsRuleById(id);
    }
}
